﻿@{
    ViewBag.Title = "Home Page";
}
<link href="~/Content/Site.css" rel="stylesheet" />
<br /><br />
<body class="body">

    @using (Html.BeginForm("GetValue", "Home"))
    {
        @model BotDetector.WebApplication.Models.Search

        <div class="center">
            <p class="title">Bot Detector</p>
            <br />
            <input id="Text1" type="text" name="txtOne" /> <br /><br />
            <div id="engine" align="center">
                <label><input id="bingid" type="checkbox" name="bingname" checked="checked"> Bing</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <label><input id="googleid" type="checkbox" name="googlename"> Google</label><br />
            </div>
            <br />
            <input id="Button1" type="submit" value="Search"/> <br /> <br /> <br />
            @if (ViewBag.Message == "Bot")
            {
                <div class="IsBot">
                    @Html.Raw("Is Bot!")
                </div>
            }
            else if (ViewBag.Message == "NotBot")
            {
                <div class="IsNotBot">
                    @Html.Raw("Not bot!")
                </div>
            }
        </div>

        <br /><br />
        <p class="historyTitle">History</p>
        <table id="tablee" align="center">
            <tr>
                <th>Search Phrase</th>
                <th>Bing</th>
                <th>Google</th>
                <th>Bing and Google</th>
            </tr>
            @foreach (var item in Model.Searches)
            {

                <tr>

                    <td>
                        @Html.DisplayFor(modelItem => item.stringContentThatWasSearched)
                    </td>
                    @if (item.BingIsBotResult.Equals("Is bot!"))
                    {
                        <td style="background-color:red; ">
                            @Html.DisplayFor(modelItem => item.BingIsBotResult)
                        </td>
                    }
                    else
                    {
                        if (item.BingIsBotResult.Equals("Not bot!"))
                        {
                            <td style="background-color:forestgreen; ">
                                @Html.DisplayFor(modelItem => item.BingIsBotResult)
                            </td>
                        }
                        else
                        {
                            <td>
                                @Html.DisplayFor(modelItem => item.BingIsBotResult)
                            </td>
                        }
                    }
                    @if (item.GoogleIsBotResult.Equals("Is bot!"))
                    {
                        <td style="background-color:red; ">
                            @Html.DisplayFor(modelItem => item.GoogleIsBotResult)
                        </td>
                    }
                    else
                    {
                        if (item.GoogleIsBotResult.Equals("Not bot!"))
                        {
                            <td style="background-color:forestgreen; ">
                                @Html.DisplayFor(modelItem => item.GoogleIsBotResult)
                            </td>
                        }
                        else
                        {
                            <td>
                                @Html.DisplayFor(modelItem => item.GoogleIsBotResult)
                            </td>
                        }
                    }
                    @if (item.BingGoogleIsBotResult.Equals("Is bot!"))
                    {
                        <td style="background-color:red; ">
                            @Html.DisplayFor(modelItem => item.BingGoogleIsBotResult)
                        </td>
                    }
                    else
                    {
                        if (item.BingGoogleIsBotResult.Equals("Not bot!"))
                        {
                            <td style="background-color:forestgreen; ">
                                @Html.DisplayFor(modelItem => item.BingGoogleIsBotResult)
                            </td>
                        }
                        else
                        {
                            <td>
                                @Html.DisplayFor(modelItem => item.BingGoogleIsBotResult)
                            </td>
                        }
                    }
                </tr>

            }
        </table>
    }
</body>